package com.feihao.service;

import com.feihao.domian.AccountEvent;
import org.apache.rocketmq.client.exception.MQClientException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public interface AccountService {

    /**
     * 更新帐号余额‐发送消息
     * producer向MQ Server发送消息
     */
    void sendUpdateAccountBalance(AccountEvent ace) throws MQClientException ;



    /**
     * 更新帐号余额‐本地事务
     * producer发送消息完成后接收到MQ Server的回应即开始执行本地事务
     * 返回是否真正执行了数据库减钱操作
     */

    @Transactional(rollbackFor = Exception.class)
    boolean doUpdateAccountBalance(AccountEvent ace);
}
